<?php

/**
 * MVM_MALL 网上商店系统 头文件
 * ============================================================================
 * 版权所有 (C) 2007-2010 www.mvmmall.com，并保留所有权利。
 * 网站地址: http://www.mvmmall.com
 * ----------------------------------------------------------------------------
 * 这是一个免费开源的软件；这意味着您可以在不用于商业目的的前提下对程序代码
 * 进行修改、使用和再发布。
 * ============================================================================
 * $Author:  www.mvmmall.com  $
 * $Date: 2008-06-28 $
 * $Id: header.php  www.mvmmall.com$
 * ---------------------------------------------
*/

if (!defined('MVMMALL')) exit;
if (MVMMALL_SCR=='index') {
	$co = 0;
    foreach ($cache->get_cache('right_tree') as $val){
        if ($co==$mm_cat_index && $mm_cat_index) {
            continue;
        }
        $co++;
        $cat_parent[]=$val;
    }
}else { 
    $cat_parent = $cache->get_cache('right_tree');
}
$sell_goods = sell_goods(dhtmlchars($action),0,$mm_sell_nums);//销售排行
$mmtop_logo = banner('top_logo','1','0','0');//logo 顶部
$mmfot_logo = banner('bottom_logo','1','0','0');//底部广告
/**最新发货通知**/
$order_notice = array();
if(file_exists(MVMMALL_CACHE.'order_notice.cache.php')){
    require_once MVMMALL_CACHE.'order_notice.cache.php';
}else {
$result = $db->query("SELECT ordersn,consignee,status,uid,sendtime FROM `{$tablepre}order_info` WHERE status='4'");
while ($list = $db->fetch_array($result)){
    $list['date']   = date($mm_date_format,$list['sendtime']);
    $list['title']  = "$lang[buyer_name]:".$list['consignee']." $lang[buy_paycode]:".$list['ordersn'];
    $list['url']    = "member.php?action=edit_order&ps_id=$list[uid]";
    $order_notice[] =$list;
}
 make_cache($order_notice,'order_notice');
}
//end

/**系统url**/
$mm_url=array();
$mm_url['index']       = GetBaseUrl('index');//首页
$mm_url['goods_new']   = GetBaseUrl('goods','new');//最新商品
$mm_url['goods_best']  = GetBaseUrl('goods','best');//推荐商品
$mm_url['goods_hot']   = GetBaseUrl('goods','hot');//热门商品
$mm_url['goods_sales'] = GetBaseUrl('goods','sales');//促销商品
$mm_url['group']       = GetBaseUrl('group','list');//团购活动
$mm_url['auction']     = GetBaseUrl('auction','list');//拍卖活动
$mm_url['login']       = GetBaseUrl('logging','login');//登陆
$mm_url['logout']      = GetBaseUrl('logging','logout');//退出
$mm_url['user_reg']    = GetBaseUrl('register');//注册
$mm_url['search']      = GetBaseUrl('search','search');//搜索
$mm_url['help']        = GetBaseUrl('page','help');//客户中心
$mm_url['sitemap']     = GetBaseUrl('sitemap');//商城导航
$mm_url['buy_explain'] = GetBaseUrl('page','explain');//购物说明
$mm_url['cart']        = GetBaseUrl('cart','list');//购物车
$mm_url['brand']       = GetBaseUrl('brand','list');//品牌展示
$mm_url['notice']      = GetBaseUrl('board','notice');//商店公告
$mm_url['freeboard']   = GetBaseUrl('board','freeboard');//客户留言
$mm_url['member']      =  array(
                     array('title'=>$lang['user_point'],'url'=>'member.php?action=point'),//积分
                     array('title'=>$lang['show_money'],'url'=>'member.php?action=money'),//会员预付款
                     array('title'=>$lang['navi_info'],'url'=>'member.php?action=info'),//推广中心
                     array('title'=>$lang['my_auction'],'url'=>'member.php?action=auction'),//拍卖记录
                     array('title'=>$lang['my_order'],'url'=>'member.php?action=order'),//我的定单
                     array('title'=>$lang['member_modify'],'url'=>'member.php?action=profile'),
                     array('title'=>$lang['my_freeboard'],'url'=>'board.php?action=freeboard&my_board=1'),
                     array('title'=>$lang['my_comment'],'url'=>'member.php?action=comment'),
                     array('title'=>$lang['buyer_add'],'url'=>'member.php?action=address'),
                     array('title'=>$lang['my_tag'],'url'=>'tag.php?action=list&mytag=1'),
                            );
/**导航**/
foreach($cache->get_cache('nav') as $val){
	switch ($val['pos']) {
		case 'head':{ $nav_head[]  =$val;break;}
		case 'foot':{ $nav_foot[]  =$val;break;}
		case 'help':{ $nav_help[]  =$val;break;}
		default:    { $nav_middle[]=$val;break;}
	}
}
//风格和css
$style_array  = $cache->get_cache('style');
if($style_id){
	unset( $_SESSION['mvm_style_id']);
	$_SESSION['mvm_style_id'] = $style_id;
}elseif ($_SESSION['mvm_style_id']){
	$style_id = $_SESSION['mvm_style_id'];
}else {
	$style_id = $mm_default_style;
}
$style_path = MVMMALL_ROOT."./data/style/style_$style_id.css";
!file_exists($style_path) && $style_path = "$imgpath/mvm.css";
//浏览记录
if(isset($_COOKIE['mvm_history'])){
	$history      = array();
	$history_list = dhtmlchars($_COOKIE['mvm_history']);
	foreach ($history_list as $val){
		if ($hi==$mm_history_number){
			continue;
		}
		++$hi;
		$val['url']     = GetBaseUrl('product',$val['uid']);
		$val['subject'] = cut_str($val['title'],$mm_goods_length);
		$history[]      = $val;
	}
}
//购物车统计信息
!$_SESSION['sum_cart'] && sun_cart(); 
$sum_cart  = $_SESSION['sum_cart'];